﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using GTR.News.AdminModel;

namespace GTR.News.AdminDAL
{
    public class VideoDAL
    {
        SqlConnection sql = new SqlConnection("Data Source=169.254.9.185;Persist Security Info=True;User ID=sa");
        /// <summary>
        /// 视屏显示
        /// </summary>
        /// <returns></returns>
        public List<Video> videoSHOW()
        {

            string s = "select * from Video";
            SqlDataAdapter adap = new SqlDataAdapter(s, sql);
            DataTable table = new DataTable();
            adap.Fill(table);
            List<Video> list = new List<Video>();
            foreach (DataRow i in table.Rows)
            {
                Video v = new Video();
                v.NewsID = Convert.ToInt32(i["NewsID"]);
                v.VideoName = i["VideoName"].ToString();
                v.VideoID = Convert.ToInt32(i["VideoID"]);
                v.VideoDate = i["VideoDate"].ToString();
                v.Video_url = i["Video_url"].ToString();
                list.Add(v);
            }
            return list;
        }

        /// <summary>
        /// 视屏删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int VideoDEL(int id)
        {
            return DBhelper.NonQuery("delete from Video where VideoID=" + id);
        }

        



    }
}
